#!/usr/bin/python3
# -*- coding: utf-8 -*-

import os
import config

from config.tools import load_yaml, dump_yaml

global_conf_file_name = "conf.yaml"
global_conf_path = os.path.join(config.DEPLOY_ROOT_PATH, global_conf_file_name)


class GlobalConf:

    def __init__(self) -> None:
        self.global_conf_file_name = global_conf_file_name
        self.global_conf_path = global_conf_path
        self.conf_map = GlobalConf.get_map()

    @staticmethod
    def get_map() -> dict:
        '''return conf.yaml's content as a dict'''
        return load_yaml(global_conf_path)

    @staticmethod
    def save_map(global_map:dict) -> None:
        dump_yaml(global_conf_path, global_map)


if __name__ == "__main__":
    a = GlobalConf.get_map()
    print(a, type(a))